package com.vne.skyemart.service.impl;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.vne.skyemart.dao.ProductsDao;
import com.vne.skyemart.model.Products;
import com.vne.skyemart.service.ProductsService;

@Service("productsService")
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class ProductsServiceImpl implements ProductsService{
	@Autowired
	private ProductsDao productsDao;

	public ProductsDao getProductsDao() {
		return productsDao;
	}

	public void setProductsDao(ProductsDao productsDao) {
		this.productsDao = productsDao;
	}
	public ProductsServiceImpl() {}
	@Transactional(propagation = Propagation.SUPPORTS,readOnly = false)
	@Override
	public void addProducts(Products products) {
		productsDao.save(products);
	}

	@Override
	public List<Products> listProducts() {
		return productsDao.findAll();
	}
	
}
